﻿using HomeCareLibrary.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace HomeCareLibrary.Controllers
{
    public class HomeController : Controller
    {
        private homewizard_test2databaseEntities db = new homewizard_test2databaseEntities();
        public ActionResult Index()
        {

            Session["promoCode"] = 123;
            var model = new HomeCareLibraryCategoryModel();

            model.listPortfolio = (from p in db.HomeCareLibraryCategories
                                   select new HomeCareLibraryCategoryModel()
                                   {
                                       ID = p.ID,
                                       HomeCare_Category = p.HomeCareLibrary_Category
                                   }).ToList();
            model.listPortfolioTags = (from p in db.Features
                                       select new HomeCareModel()
                                       {
                                           CategoryID = p.categoryID,
                                           Feature_code = p.feature_code.Trim(),
                                           Feature_Name = p.feature_name,
                                           Feature_description = p.feature_description,
                                           feature_url = p.feature_url
                                       }).ToList();
            return View(model);

        }
        public ActionResult overview(string ID)
        {
            Session["promoCode"] = 123;

            var model = new OverviewModel();
            try
            {
                model = (from p in db.HCL_Overview
                         join f in db.Features on p.feature_code equals f.feature_code
                         join rc in db.RC_Task_Details on f.feature_code equals rc.feature_code
                         join qa in db.HCL_QA_Urls on f.feature_code equals qa.feature_code
                         where f.feature_name == ID.Replace("-", " ")
                         orderby qa.qa_topic_order ascending
                         select new OverviewModel()
                         {
                             feature_code = p.feature_code.Trim(),

                             overview_content = p.overview_content,
                             overview_ImageURL = p.overview_imageURL,
                             overview_URL = p.overview_url,
                             Feature_name = f.feature_name.Trim(),
                             meta_description = p.overview_meta_desc,
                             meta_key = p.overview_meta_thumb,
                             rc_task_content = rc.rc_task_content,
                             qa_topic = qa.qa_topic

                         }).FirstOrDefault();

            }
            catch { }

            if (Request.IsAjaxRequest())
                return PartialView("overviewPartial", model);
            else
                return View(model);
        }
        public ActionResult care(string ID, string featureID)
        {
            Session["promoCode"] = 123;
            var model = new careModel();
            try
            {

                if (featureID == null)
                {
                    model = (from p in db.RC_Task_Details
                             join f in db.Features on p.feature_code equals f.feature_code
                             join o in db.HCL_Tasks on p.feature_code equals o.feature_code
                             join qa in db.HCL_QA_Urls on p.feature_code equals qa.feature_code
                             where f.feature_name == ID.Replace("-", " ")
                             orderby qa.qa_topic_order ascending
                             select new careModel()
                             {
                                 feature_code = p.feature_code.Trim(),
                                 Feature_name = f.feature_name,
                                 task_code = p.task_code.Trim(),
                                 Display_icon_code = p.display_icon_code,
                                 rc_task_title = p.rc_task_title,
                                 rc_task_content = p.rc_task_content,
                                 rc_rec_timing = p.rc_rec_timing,
                                 rc_priority = p.rc_priority,
                                 rc_type = p.rc_type,
                                 rc_benefit_content = p.rc_benefit_content,
                                 rc_energy_saving_score = p.rc_energy_savings_score,
                                 rc_energy_saving_content = p.rc_energy_savings_content,
                                 rc_cost_score = p.rc_cost_score,
                                 rc_cost_content = p.rc_cost_content,
                                 rc_more_info_link = p.rc_more_info_link,
                                 rc_knowledge_level = p.rc_knowledge_level,
                                 rc_cycle_timing = p.rc_cycle_timing,
                                 rc_timing_months = p.rc_timing_months,
                                 rc_task_order = p.rc_task_order,
                                 rc_task_url = p.rc_task_url,
                                 rc_task_description = p.rc_task_description,
                                 rc_excluded_features = p.rc_excluded_features,
                                 task_intro = o.task_intro,
                                 task_howto_image = o.task_howto_imageURL,
                                 task_howto = o.task_howto,
                                 task_benefits_full = o.task_benefits_full,
                                 task_ensav_full = o.task_ensav_full,
                                 task_costs_full = o.task_costs_full,
                                 task_meta_desc = o.task_meta_desc,
                                 task_meta_key = o.task_meta_key,
                                 qa_topic = qa.qa_topic
                             }).FirstOrDefault();



                    var getPortfolioDescriptionID2 = (from p in db.RC_Task_Details where p.feature_code == ID select p.task_code).FirstOrDefault();

                    model.listRoutine = (from p in db.RC_Task_Details
                                         join f in db.Features on p.feature_code equals f.feature_code
                                         where f.feature_name == ID.Replace("-", " ") && p.task_code != getPortfolioDescriptionID2

                                         select new careModel()
                                         {

                                             feature_code = p.feature_code.Trim(),
                                             Feature_name = f.feature_name,
                                             task_code = p.task_code.Trim(),
                                             Display_icon_code = p.display_icon_code,
                                             rc_task_title = p.rc_task_title,
                                             rc_task_content = p.rc_task_content,
                                             rc_rec_timing = p.rc_rec_timing,
                                             rc_priority = p.rc_priority,
                                             rc_type = p.rc_type,
                                             rc_benefit_content = p.rc_benefit_content,
                                             rc_energy_saving_score = p.rc_energy_savings_score,
                                             rc_energy_saving_content = p.rc_energy_savings_content,
                                             rc_cost_score = p.rc_cost_score,
                                             rc_cost_content = p.rc_cost_content,
                                             rc_more_info_link = p.rc_more_info_link,
                                             rc_knowledge_level = p.rc_knowledge_level,
                                             rc_cycle_timing = p.rc_cycle_timing,
                                             rc_timing_months = p.rc_timing_months,
                                             rc_task_order = p.rc_task_order,
                                             rc_task_url = p.rc_task_url,
                                             rc_task_description = p.rc_task_description,
                                             rc_excluded_features = p.rc_excluded_features,

                                         }).ToList();
                }
                else
                {
                    model = (from p in db.RC_Task_Details
                             join f in db.Features on p.feature_code equals f.feature_code
                             join o in db.HCL_Tasks on p.task_code equals o.task_code
                             join qa in db.HCL_QA_Urls on p.feature_code equals qa.feature_code
                             join b in db.RC_Task_Benefits on p.task_code equals b.task_code
                             where p.rc_task_content == featureID.Replace("-", " ")
                             orderby qa.qa_topic_order ascending
                             select new careModel()
                             {
                                 feature_code = p.feature_code.Trim(),
                                 Feature_name = f.feature_name,
                                 task_code = p.task_code.Trim(),
                                 Display_icon_code = p.display_icon_code,
                                 rc_task_title = p.rc_task_title,
                                 rc_task_content = p.rc_task_content,
                                 rc_rec_timing = p.rc_rec_timing,
                                 rc_priority = p.rc_priority,
                                 rc_type = p.rc_type,
                                 rc_benefit_content = p.rc_benefit_content,
                                 rc_energy_saving_score = p.rc_energy_savings_score,
                                 rc_energy_saving_content = p.rc_energy_savings_content,
                                 rc_cost_score = p.rc_cost_score,
                                 rc_cost_content = p.rc_cost_content,
                                 rc_more_info_link = p.rc_more_info_link,
                                 rc_knowledge_level = p.rc_knowledge_level,
                                 rc_cycle_timing = p.rc_cycle_timing,
                                 rc_timing_months = p.rc_timing_months,
                                 rc_task_order = p.rc_task_order,
                                 rc_task_url = p.rc_task_url,
                                 rc_task_description = p.rc_task_description,
                                 rc_excluded_features = p.rc_excluded_features,
                                 task_intro = o.task_intro,
                                 task_howto_image = o.task_howto_imageURL,
                                 task_howto = o.task_howto,
                                 task_benefits_full = o.task_benefits_full,
                                 task_ensav_full = o.task_ensav_full,
                                 task_costs_full = o.task_costs_full,
                                 task_meta_desc = o.task_meta_desc,
                                 task_meta_key = o.task_meta_key,
                                 qa_topic = qa.qa_topic,
                                 benifits_image = b.tbr_web_display_order
                             }).FirstOrDefault();


                    model.listRoutine = (from p in db.RC_Task_Details
                                         join f in db.Features on p.feature_code equals f.feature_code
                                         where f.feature_name == ID.Replace("-", " ") && p.rc_task_content != featureID.Replace("-", " ")

                                         select new careModel()
                                         {
                                             feature_code = p.feature_code.Trim(),
                                             Feature_name = f.feature_name,
                                             task_code = p.task_code.Trim(),
                                             Display_icon_code = p.display_icon_code,
                                             rc_task_title = p.rc_task_title,
                                             rc_task_content = p.rc_task_content,
                                             rc_rec_timing = p.rc_rec_timing,
                                             rc_priority = p.rc_priority,
                                             rc_type = p.rc_type,
                                             rc_benefit_content = p.rc_benefit_content,
                                             rc_energy_saving_score = p.rc_energy_savings_score,
                                             rc_energy_saving_content = p.rc_energy_savings_content,
                                             rc_cost_score = p.rc_cost_score,
                                             rc_cost_content = p.rc_cost_content,
                                             rc_more_info_link = p.rc_more_info_link,
                                             rc_knowledge_level = p.rc_knowledge_level,
                                             rc_cycle_timing = p.rc_cycle_timing,
                                             rc_timing_months = p.rc_timing_months,
                                             rc_task_order = p.rc_task_order,
                                             rc_task_url = p.rc_task_url,
                                             rc_task_description = p.rc_task_description,
                                             rc_excluded_features = p.rc_excluded_features
                                         }).ToList();
                }
            }
            catch { }
            if (Request.IsAjaxRequest())
                return PartialView("carePartial", model);
            else
                return View(model);
        }
        public ActionResult questions(string ID, string featureID)
        {
            Session["promoCode"] = 123;

            var model = new questionsModel();
            try
            {
                if (featureID == null)
                {
                    model = (from p in db.HCL_QA_Urls
                             join f in db.Features on p.feature_code equals f.feature_code
                             where f.feature_name == ID.Replace("-", " ")
                             select new questionsModel()
                             {
                                 feature_code = p.feature_code.Trim(),
                                 Feature_name = f.feature_name,
                                 qa_topic_order = p.qa_topic_order,
                                 qa_topic_code = p.qa_topic_code,
                                 qa_topic = p.qa_topic,
                                 qa_topic_intro = p.qa_topic_intro,
                                 qa_image_url = p.qa_image_url,
                                 qa_topic_url = p.qa_topic_url,
                                 qa_topic_meta_desc = p.qa_topic_meta_desc,
                                 qa_topic_meta_key = p.qa_topic_meta_thumb,


                             }).FirstOrDefault();
                    var getPortfolioDescriptionID = (from p in db.HCL_QA_Urls join f in db.Features on p.feature_code equals f.feature_code where f.feature_name == ID.Replace("-", " ") select p.qa_topic_code).FirstOrDefault();
                    model.listQ_A = (from p in db.HCL_QA_Contents
                                     where p.qa_topic_code == getPortfolioDescriptionID
                                     select new Q_AUrlModel()
                                          {
                                              qa_topic_code = p.qa_topic_code.Trim(),
                                              qa_qa_order = p.qa_qa_order,
                                              qa_followon_order = p.qa_followon_order,
                                              qa_question = p.qa_question,
                                              qa_answer = p.qa_answer,

                                          }).ToList();
                    var getPortfolioDescriptionID2 = (from p in db.HCL_QA_Urls join f in db.Features on p.feature_code equals f.feature_code where f.feature_name == ID.Replace("-", " ") select p.qa_topic_code).FirstOrDefault();
                    model.listQ_AContent = (from p in db.HCL_QA_Urls
                                            join f in db.Features on p.feature_code equals f.feature_code
                                            where f.feature_name == ID.Replace("-", " ") && p.qa_topic_code != getPortfolioDescriptionID2
                                            select new questionsModel()
                                            {
                                                feature_code = p.feature_code.Trim(),
                                                qa_topic_order = p.qa_topic_order,
                                                qa_topic_code = p.qa_topic_code.Trim(),
                                                qa_topic = p.qa_topic,
                                                qa_topic_intro = p.qa_topic_intro,
                                                qa_image_url = p.qa_image_url,
                                                qa_topic_url = p.qa_topic_url,
                                                qa_topic_meta_desc = p.qa_topic_meta_desc,
                                                qa_topic_meta_key = p.qa_topic_meta_thumb,
                                                Feature_name = f.feature_name

                                            }).ToList();
                }
                else
                {
                    model = (from p in db.HCL_QA_Urls
                             join f in db.Features on p.feature_code equals f.feature_code
                             join rc in db.RC_Task_Details on f.feature_code equals rc.feature_code
                             where f.feature_name == ID.Replace("-", " ") && p.qa_topic == featureID.Replace("-", " ")

                             select new questionsModel()
                             {
                                 feature_code = p.feature_code.Trim(),
                                 qa_topic_order = p.qa_topic_order,
                                 qa_topic_code = p.qa_topic_code.Trim(),
                                 qa_topic = p.qa_topic,
                                 qa_topic_intro = p.qa_topic_intro,
                                 qa_image_url = p.qa_image_url,
                                 qa_topic_url = p.qa_topic_url,
                                 qa_topic_meta_desc = p.qa_topic_meta_desc,
                                 qa_topic_meta_key = p.qa_topic_meta_thumb,
                                 Feature_name = f.feature_name,
                                 rc_task_content = rc.rc_task_content,
                             }).FirstOrDefault();
                    var topic_code = (from p in db.HCL_QA_Urls where p.qa_topic == featureID.Replace("-", " ") select p.qa_topic_code).FirstOrDefault();
                    model.listQ_A = (from p in db.HCL_QA_Contents

                                     where p.qa_topic_code == topic_code
                                     orderby p.qa_qa_order ascending
                                     select new Q_AUrlModel()
                                     {


                                         qa_topic_code = p.qa_topic_code.Trim(),
                                         qa_qa_order = p.qa_qa_order,
                                         qa_followon_order = p.qa_followon_order,
                                         qa_question = p.qa_question,
                                         qa_answer = p.qa_answer,

                                     }).ToList();
                    model.listQ_AContent = (from p in db.HCL_QA_Urls
                                            join f in db.Features on p.feature_code equals f.feature_code
                                            where f.feature_name == ID.Replace("-", " ") && p.qa_topic != featureID.Replace("-", " ")
                                            select new questionsModel()
                                            {
                                                feature_code = p.feature_code.Trim(),
                                                qa_topic_order = p.qa_topic_order,
                                                qa_topic_code = p.qa_topic_code.Trim(),
                                                qa_topic = p.qa_topic,
                                                qa_topic_intro = p.qa_topic_intro,
                                                qa_image_url = p.qa_image_url,
                                                qa_topic_url = p.qa_topic_url,
                                                qa_topic_meta_desc = p.qa_topic_meta_desc,
                                                qa_topic_meta_key = p.qa_topic_meta_thumb,
                                                Feature_name = f.feature_name

                                            }).ToList();
                }
            }
            catch { }
            if (Request.IsAjaxRequest())
                return PartialView("questionsPartial", model);
            else
                return View(model);

        }
        public ActionResult articles(string ID, string featureID)
        {
            Session["promoCode"] = 123;
            if (featureID == "" ||featureID==null)
            {
                var model = new ArticlesModel();
                try
                {
                    model = (from d in db.HCL_Article_Displays
                             join a in db.HCL_Article_Details on d.article_code equals a.article_code
                             join f in db.Features on d.feature_code equals f.feature_code
                             join rc in db.RC_Task_Details on f.feature_code equals rc.feature_code
                             join qa in db.HCL_QA_Urls on f.feature_code equals qa.feature_code
                             where f.feature_name == ID.Replace("-", " ")
                             orderby qa.qa_topic_order ascending
                             select new ArticlesModel()
                             {
                                 //featureID = p.featureID,

                                 feature_code = f.feature_code.Trim(),
                                 article_code = a.article_code.Trim(),
                                 article_title = a.article_title,
                                 article_summary = a.article_summary,
                                 article_small_image_icon = a.article_small_image_url,
                                 article_big_image = a.article_big_image,
                                 article_bottom_content = a.article_bottom_content,
                                 article_top_content = a.article_top_content,
                                 article_video = a.article_video,
                                 article_Url = a.article_url,
                                 Feature_name = f.feature_name,
                                 article_meta_desc = a.article_meta_desc,
                                 article_meta_key = a.article_meta_thumb,
                                 rc_task_content = rc.rc_task_content,
                                 qa_topic = qa.qa_topic
                             }).FirstOrDefault();



                    //Get portfolioDescriptionID

                    model.listArtical = (from d in db.HCL_Article_Displays
                                         join a in db.HCL_Article_Details on d.article_code equals a.article_code
                                         join f in db.Features on d.feature_code equals f.feature_code
                                         where f.feature_name == ID.Replace("-", " ")
                                         select new ArticlesModel()
                                          {
                                              feature_code = f.feature_code.Trim(),
                                              article_code = a.article_code.Trim(),
                                              article_title = a.article_title,
                                              article_summary = a.article_summary,
                                              article_small_image_icon = a.article_small_image_url,
                                              article_big_image = a.article_big_image,
                                              article_bottom_content = a.article_bottom_content,
                                              article_top_content = a.article_top_content,
                                              article_video = a.article_video,
                                              Feature_name = f.feature_name,
                                              article_meta_desc = a.article_meta_desc,
                                              article_meta_key = a.article_meta_thumb
                                          }).ToList();
                }
                catch { }
                if (Request.IsAjaxRequest())
                    return PartialView("articlesPartial", model);
                else
                    return View(model);
            }
            else
            {
                var model = new ArticlesModel();
                try
                {
                    var articlecode = (from d in db.HCL_Article_Details where d.article_title == featureID.Replace("-", " ") select d.article_code).FirstOrDefault();
                    model = (from d in db.HCL_Article_Displays
                             join a in db.HCL_Article_Details on d.article_code equals a.article_code
                             join f in db.Features on d.feature_code equals f.feature_code
                             join rc in db.RC_Task_Details on f.feature_code equals rc.feature_code
                             join qa in db.HCL_QA_Urls on f.feature_code equals qa.feature_code
                             where d.article_code == articlecode && f.feature_name == ID.Replace("-", " ")
                             orderby qa.qa_topic_order ascending
                             select new ArticlesModel()
                             {
                                 feature_code = f.feature_code.Trim(),
                                 article_code = a.article_code.Trim(),
                                 article_title = a.article_title,
                                 article_summary = a.article_summary,
                                 article_small_image_icon = a.article_small_image_url,
                                 article_big_image = a.article_big_image,
                                 article_bottom_content = a.article_bottom_content,
                                 article_top_content = a.article_top_content,
                                 article_video = a.article_video,
                                 article_Url = a.article_url,
                                 Feature_name = f.feature_name,
                                 article_meta_desc = a.article_meta_desc,
                                 article_meta_key = a.article_meta_thumb,
                                 rc_task_content = rc.rc_task_content,
                                 qa_topic = qa.qa_topic
                             }).FirstOrDefault();

                    //Get portfolioDescriptionID
                    //var getPortfolioDescriptionID = (from p in db.Features where p.ID == ID select p.ID).FirstOrDefault();
                    model.listArtical = (from d in db.HCL_Article_Displays
                                         join a in db.HCL_Article_Details on d.article_code equals a.article_code
                                         join f in db.Features on d.feature_code equals f.feature_code
                                         where f.feature_name == ID.Replace("-", " ") && d.article_code != articlecode
                                         select new ArticlesModel()
                                         {
                                             feature_code = f.feature_code.Trim(),
                                             article_code = a.article_code.Trim(),
                                             article_title = a.article_title,
                                             article_summary = a.article_summary,
                                             article_small_image_icon = a.article_small_image_url,
                                             article_big_image = a.article_big_image,
                                             article_bottom_content = a.article_bottom_content,
                                             article_top_content = a.article_top_content,
                                             article_video = a.article_video,
                                             Feature_name = f.feature_name,
                                             article_meta_desc = a.article_meta_desc,
                                             article_meta_key = a.article_meta_thumb
                                         }).ToList();
                }
                catch { }
                if (model.article_video == null)
                    if (Request.IsAjaxRequest())
                        return PartialView("articalesdetailPartial", model);
                    else
                        return View("ArticleDetail", model);
                else
                    if (Request.IsAjaxRequest())
                        return PartialView("articlevideosPartial", model);
                    else
                        return View("ArticleDetailVideo", model);
            }
        }
        public ActionResult ArticleDetail(string ID, string featureID)
        {
            var model = new ArticlesModel();
            try
            {
                model = (from d in db.HCL_Article_Displays
                         join a in db.HCL_Article_Details on d.article_code equals a.article_code
                         join f in db.Features on d.feature_code equals f.feature_code
                         where d.article_code == ID && f.feature_code == featureID
                         select new ArticlesModel()
                         {
                             feature_code = f.feature_code.Trim(),
                             article_code = a.article_code.Trim(),
                             article_title = a.article_title,
                             article_summary = a.article_summary,
                             article_small_image_icon = a.article_small_image_url,
                             article_big_image = a.article_big_image,
                             article_bottom_content = a.article_bottom_content,
                             article_top_content = a.article_top_content,
                             article_video = a.article_video,
                             article_Url = a.article_url,
                             Feature_name = f.feature_name,
                             article_meta_desc = a.article_meta_desc,
                             article_meta_key = a.article_meta_thumb
                         }).FirstOrDefault();


                model.listArtical = (from d in db.HCL_Article_Displays
                                     join a in db.HCL_Article_Details on d.article_code equals a.article_code
                                     join f in db.Features on d.feature_code equals f.feature_code
                                     where f.feature_code == featureID && d.article_code != ID
                                     select new ArticlesModel()
                                     {
                                         feature_code = f.feature_code.Trim(),
                                         article_code = a.article_code.Trim(),
                                         article_title = a.article_title,
                                         article_summary = a.article_summary,
                                         article_small_image_icon = a.article_small_image_url,
                                         article_big_image = a.article_big_image,
                                         article_bottom_content = a.article_bottom_content,
                                         article_top_content = a.article_top_content,
                                         article_video = a.article_video,
                                         Feature_name = f.feature_name,
                                         article_meta_desc = a.article_meta_desc,
                                         article_meta_key = a.article_meta_thumb
                                     }).ToList();
            }
            catch { }
            return View(model);
        }
        public ActionResult ArticleDetailVideo(string ID, string featureID)
        {
            var model = new ArticlesModel();
            try
            {
                model = (from d in db.HCL_Article_Displays
                         join a in db.HCL_Article_Details on d.article_code equals a.article_code
                         join f in db.Features on d.feature_code equals f.feature_code
                         where d.article_code == ID && f.feature_code == featureID
                         select new ArticlesModel()
                         {
                             feature_code = f.feature_code.Trim(),
                             article_code = a.article_code.Trim(),
                             article_title = a.article_title,
                             article_summary = a.article_summary,
                             article_small_image_icon = a.article_small_image_url,
                             article_big_image = a.article_big_image,
                             article_bottom_content = a.article_bottom_content,
                             article_top_content = a.article_top_content,
                             article_video = a.article_video,
                             article_Url = a.article_url,
                             Feature_name = f.feature_name,
                             article_meta_desc = a.article_meta_desc,
                             article_meta_key = a.article_meta_thumb
                         }).FirstOrDefault();

                //Get portfolioDescriptionID
                //var getPortfolioDescriptionID = (from p in db.Features where p.ID == ID select p.ID).FirstOrDefault();
                model.listArtical = (from d in db.HCL_Article_Displays
                                     join a in db.HCL_Article_Details on d.article_code equals a.article_code
                                     join f in db.Features on d.feature_code equals f.feature_code
                                     where f.feature_code == featureID && d.article_code != ID
                                     select new ArticlesModel()
                                     {
                                         feature_code = f.feature_code.Trim(),
                                         article_code = a.article_code.Trim(),
                                         article_title = a.article_title,
                                         article_summary = a.article_summary,
                                         article_small_image_icon = a.article_small_image_url,
                                         article_big_image = a.article_big_image,
                                         article_bottom_content = a.article_bottom_content,
                                         article_top_content = a.article_top_content,
                                         article_video = a.article_video,
                                         Feature_name = f.feature_name,
                                         article_meta_desc = a.article_meta_desc,
                                         article_meta_key = a.article_meta_thumb
                                     }).ToList();
            }
            catch { }
            return View(model);
        }
        //[ChildActionOnly]
        public ActionResult DisplayUserName(int ID)
        {
            var model = new SponsorInputs345xModel();

            model = (from u in db.SponsorInputs345x
                     where u.Sponsor_ID == ID
                     select new SponsorInputs345xModel()
                     {
                         Sponsor_ID = u.Sponsor_ID,
                         spon_pic = u.Spon_Pic,
                         spon_logo = u.Spon_Logo,
                         spon_logo_tag = u.Spon_Logo_Tag,
                         spon_yourname = u.Spon_YourName,
                         spon_phoneban = u.Spon_PhoneBan,
                         spon_email = u.Spon_Email,
                         spon_web_add = u.Spon_Web_Add


                     }).FirstOrDefault();

            return PartialView("Partial1", model);
        }
        public ActionResult menu()
        {


            var model = new MainMenuModel();

            model.listCategory = (from p in db.HomeCareLibraryCategories
                                  select new MainMenuModel()
                                  {
                                      ID = p.ID,
                                      HomeCare_Category = p.HomeCareLibrary_Category
                                  }).ToList();
            model.listSubCategory = (from p in db.Features
                                     select new SubmenuModel()
                                     {
                                         CategoryID = p.categoryID,
                                         Feature_code = p.feature_code.Trim(),
                                         Feature_Name = p.feature_name,
                                         Feature_description = p.feature_description,
                                         feature_url = p.feature_url
                                     }).ToList();
            return PartialView("menu", model);

        }
        public ActionResult UserDetails(int ID)
        {
            var model = new SponsorInputs345xModel();

            model = (from u in db.SponsorInputs345x
                     where u.Sponsor_ID == ID
                     select new SponsorInputs345xModel()
                     {
                         Sponsor_ID = u.Sponsor_ID,
                         spon_pic = u.Spon_Pic,
                         spon_logo = u.Spon_Logo,
                         spon_logo_tag = u.Spon_Logo_Tag,
                         spon_yourname = u.Spon_YourName,
                         spon_phoneban = u.Spon_PhoneBan,
                         spon_email = u.Spon_Email,
                         spon_web_add = u.Spon_Web_Add


                     }).FirstOrDefault();

            return PartialView("UserDetails", model);
        }


        public ActionResult Welcome()
        {
           return View();
        }
        public ActionResult Login()
        {
            return View();
        }
        public ActionResult Intialsetup()
        {
            return View();
        }
        public ActionResult About()
        {
            return View();
        }
       
    }
}
